import 'dart:convert';

import '../../utils/index.dart';


class CommonTabTitle {
  String labelName;
  String groupChannelCode;
  int type;

  CommonTabTitle({
    required this.labelName,
    required this.groupChannelCode,
    required this.type,
  });

  factory CommonTabTitle.fromJson(Map<String, dynamic> jsonRes) => CommonTabTitle(
    labelName: asT<String>(jsonRes['labelName'])!,
    groupChannelCode: asT<String>(jsonRes['groupChannelCode'])!,
    type: asT<int>(jsonRes['type'])!,
  );

  @override
  String toString() {
    return jsonEncode(this);
  }

  Map<String, dynamic> toJson() => <String, dynamic>{
    'labelName': labelName,
    'groupChannelCode': groupChannelCode,
    'type': type,
  };

  CommonTabTitle clone() => CommonTabTitle.fromJson(
      asT<Map<String, dynamic>>(jsonDecode(jsonEncode(this)))!);
}